﻿@{
    ViewBag.Title = "日志分类列表";
    Layout = "~/Views/Shared/_ListLayout.cshtml";
}
@inherits CMSWebViewPage<object>
<div id="toolbar_logcategory" class="datagrid-toolbar">
    @CurrentButtonTool.Create()
</div>
<table id="dg_logcategory" data-options="url:'/logcategory/listjson?parentid=@TransferID',border:false,fit:true,fitColumns:true,toolbar:'#toolbar_logcategory',singleSelect:true,pagination:true,pageSize:20">
    <thead>
        <tr>
            <th data-options="field:'ck',checkbox:true"></th>
            <th data-options="field:'Id',width:20,align:'center'">Id</th>
            <th data-options="field:'CategoryName',width:50,align:'center'">分类名称</th>
            <th data-options="field:'CategoryCode',width:50,align:'center'">分类编码</th>
            <th data-options="field:'ParentId',width:20,align:'center'">父节点d</th>
            <th data-options="field:'HasChild',formatter:BooleanToString,width:50,align:'center'">是否有子节点</th>
            <th data-options="field:'SaveType',formatter:FormatSaveType,width:120,align:'center'">存储类型</th>
        </tr>
    </thead>
</table>
@section Bottom{
    <script type="text/javascript">
        var objBizDatagrid = new BizDatagrid('#dg_logcategory');
        function Add() {
            objBizDatagrid.add("/logcategory/editpage/");
        }
        function Edit() {
            objBizDatagrid.edit("/logcategory/editpage/");
        }
        function Search() {
            objBizDatagrid.search('#fr_search_logcategory', '/logcategory/listjson?parentid=@TransferID');
        }
        function Delete() {
            objBizDatagrid.del('/logcategory/delete/');
        }
        function FormatSaveType(val) {
            if (!val) {
                return "";
            }
            var saveTypes = { "0": "db", "1": "file" };
            var array = [];
            $.each(val.split(','), function (i, item) {
                array.push(saveTypes[item]);
            });
            return array.join(',');
        }
    </script>
}
